package com.ktjiaoyu.crm.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ktjiaoyu.crm.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper extends BaseMapper<User> {


    List<User> getUsersAndRole();

    /**
     * 分页查询数据
     * @param page
     * @param queryWrapper
     * @return
     */
    List<User> selectUserPages(IPage<User> page, @Param(Constants.WRAPPER) Wrapper<User> queryWrapper);

    @Insert("insert into sys_user(usr_name,usr_password,usr_role_id,usr_flag) values(#{usrName},#{usrPassword},#{role.roleId},#{usrFlag})")
    boolean addUsers(User user);


    User getUesrByName(@Param(Constants.WRAPPER) Wrapper<User> queryWrapper);

}
